/*
 * Copyright 2007 National Bioinformatics Network
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package dgbgui.gui.dialogs;

import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;

import dgbgui.tools.DialogedTool;

@SuppressWarnings("serial")
public class NeighbourhoodDialog extends DGBGUIDialog {
    
        public NeighbourhoodDialog(DialogedTool tool) {
            super(tool,"Neighbourhood");
            
            setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
            
            // From
            add(m_fromPanel = new ComboBoxPanel("From"));

            // The depth box
            add(m_depthPanel = new SpinnerPanel("Depth"));

            // The layer panel
            add(m_layerPanel = new ComboBoxPanel("In layer"));
            
            // The relation panel
            add(m_relationPanel = new ComboBoxPanel("Through relations"));
            
            // Add the OK and Cancel buttons
            JPanel buttonsPanel = new JPanel();
            buttonsPanel.setLayout(new BoxLayout(buttonsPanel,BoxLayout.X_AXIS));
            m_okButton = new JButton("OK");
            m_cancelButton = new JButton("Cancel");
            buttonsPanel.add(m_okButton);
            buttonsPanel.add(m_cancelButton);

            m_okButton.addActionListener(tool);
            m_cancelButton.addActionListener(tool);

            add(buttonsPanel);
        }
        
//      From
        
        public DefaultComboBoxModel getFromModel() {
            return m_fromPanel.getModel();
        }
        public void setFromModel(DefaultComboBoxModel model) {
            m_fromPanel.setModel(model);
        }    
        
        // Depth
        
        public SpinnerNumberModel getDepthModel() {
            return m_depthPanel.getModel();
        }
        public void setDepthModel(SpinnerNumberModel model) {
            m_depthPanel.setModel(model);
        }
        
        // Layer

        public DefaultComboBoxModel getLayerModel() {
            return m_layerPanel.getModel();
        }
        public void setLayerModel(DefaultComboBoxModel model) {
            m_layerPanel.setModel(model);
        }
        
        // Relation

        public DefaultComboBoxModel getRelationModel() {
            return m_relationPanel.getModel();
        }
        public void setRelationModel(DefaultComboBoxModel model) {
            m_relationPanel.setModel(model);
        }
        
        private SpinnerPanel m_depthPanel;
        private ComboBoxPanel m_fromPanel;
        private ComboBoxPanel m_layerPanel;
        private ComboBoxPanel m_relationPanel;

}
